diff options
| author | Maze Winther <mazewinther@gmail.com> | 2026-03-27 00:55:15 +0100 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2026-03-29 15:56:48 +0200 |
| commit | 4d127a038bf768eded68aae3cfa5c1b12241bdac (patch) | |
| tree | 16bbb801caf6770546cff4fdb37b6408ec9ead98 /apps/web/src/app/changelog/[version]/page.tsx | |
| parent | 82817cb50cb0487350573d6129130aec705f924b (diff) | |
| download | opencut-4d127a038bf768eded68aae3cfa5c1b12241bdac.tar.gz | |
chore: normalize line endings
Diffstat (limited to 'apps/web/src/app/changelog/[version]/page.tsx')
| -rw-r--r-- | apps/web/src/app/changelog/[version]/page.tsx | 210 |
1 files changed, 105 insertions, 105 deletions
diff --git a/apps/web/src/app/changelog/[version]/page.tsx b/apps/web/src/app/changelog/[version]/page.tsx index af382822..a3647fbd 100644 --- a/apps/web/src/app/changelog/[version]/page.tsx +++ b/apps/web/src/app/changelog/[version]/page.tsx @@ -1,105 +1,105 @@ -import type { Metadata } from "next"; -import Link from "next/link"; -import { notFound } from "next/navigation"; -import { BasePage } from "@/app/base-page"; -import { allChangelogs } from "content-collections"; -import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"; -import { getSortedReleases } from "../utils"; -import { - ReleaseArticle, - ReleaseMeta, - ReleaseTitle, - ReleaseDescription, - ReleaseChanges, -} from "../components/release"; -import { CopyMarkdownButton } from "../components/copy-markdown-button"; - -type Props = { params: Promise<{ version: string }> }; - -export async function generateStaticParams() { - return allChangelogs.map((r) => ({ version: r.version })); -} - -export async function generateMetadata({ params }: Props): Promise<Metadata> { - const { version } = await params; - const release = allChangelogs.find((r) => r.version === version); - if (!release) return {}; - return { - title: `${release.title} (${release.version}) - OpenCut Changelog`, - description: release.description, - }; -} - -export default async function ReleaseDetailPage({ params }: Props) { - const { version } = await params; - const releases = getSortedReleases(); - const index = releases.findIndex((r) => r.version === version); - - if (index === -1) notFound(); - - const release = releases[index]; - const newer = index > 0 ? releases[index - 1] : null; - const older = index < releases.length - 1 ? releases[index + 1] : null; - - return ( - <BasePage> - <div className="mx-auto w-full max-w-3xl flex flex-col gap-12"> - <Link - href="/changelog" - className="text-sm text-muted-foreground hover:text-foreground flex items-center gap-1 w-fit" - > - <ChevronLeftIcon className="size-4" /> - All releases - </Link> - - <ReleaseArticle variant="detail"> - <div className="flex flex-col gap-4"> - <div className="flex items-center justify-between"> - <ReleaseMeta release={release} /> - <CopyMarkdownButton - description={release.description} - changes={release.changes} - /> - </div> - <ReleaseTitle as="h1">{release.title}</ReleaseTitle> - {release.description && ( - <ReleaseDescription>{release.description}</ReleaseDescription> - )} - </div> - <ReleaseChanges release={release} /> - </ReleaseArticle> - - <nav className="flex items-center justify-between border-t pt-8"> - {older ? ( - <Link - href={`/changelog/${older.version}`} - className="flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground group" - > - <ChevronLeftIcon className="size-4" /> - <div className="flex flex-col"> - <span className="text-xs text-muted-foreground/60">Older</span> - <span className="font-medium">{older.title}</span> - </div> - </Link> - ) : ( - <div /> - )} - {newer ? ( - <Link - href={`/changelog/${newer.version}`} - className="flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground group text-right" - > - <div className="flex flex-col"> - <span className="text-xs text-muted-foreground/60">Newer</span> - <span className="font-medium">{newer.title}</span> - </div> - <ChevronRightIcon className="size-4" /> - </Link> - ) : ( - <div /> - )} - </nav> - </div> - </BasePage> - ); -} +import type { Metadata } from "next";
+import Link from "next/link";
+import { notFound } from "next/navigation";
+import { BasePage } from "@/app/base-page";
+import { allChangelogs } from "content-collections";
+import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
+import { getSortedReleases } from "../utils";
+import {
+ ReleaseArticle,
+ ReleaseMeta,
+ ReleaseTitle,
+ ReleaseDescription,
+ ReleaseChanges,
+} from "../components/release";
+import { CopyMarkdownButton } from "../components/copy-markdown-button";
+
+type Props = { params: Promise<{ version: string }> };
+
+export async function generateStaticParams() {
+ return allChangelogs.map((r) => ({ version: r.version }));
+}
+
+export async function generateMetadata({ params }: Props): Promise<Metadata> {
+ const { version } = await params;
+ const release = allChangelogs.find((r) => r.version === version);
+ if (!release) return {};
+ return {
+ title: `${release.title} (${release.version}) - OpenCut Changelog`,
+ description: release.description,
+ };
+}
+
+export default async function ReleaseDetailPage({ params }: Props) {
+ const { version } = await params;
+ const releases = getSortedReleases();
+ const index = releases.findIndex((r) => r.version === version);
+
+ if (index === -1) notFound();
+
+ const release = releases[index];
+ const newer = index > 0 ? releases[index - 1] : null;
+ const older = index < releases.length - 1 ? releases[index + 1] : null;
+
+ return (
+ <BasePage>
+ <div className="mx-auto w-full max-w-3xl flex flex-col gap-12">
+ <Link
+ href="/changelog"
+ className="text-sm text-muted-foreground hover:text-foreground flex items-center gap-1 w-fit"
+ >
+ <ChevronLeftIcon className="size-4" />
+ All releases
+ </Link>
+
+ <ReleaseArticle variant="detail">
+ <div className="flex flex-col gap-4">
+ <div className="flex items-center justify-between">
+ <ReleaseMeta release={release} />
+ <CopyMarkdownButton
+ description={release.description}
+ changes={release.changes}
+ />
+ </div>
+ <ReleaseTitle as="h1">{release.title}</ReleaseTitle>
+ {release.description && (
+ <ReleaseDescription>{release.description}</ReleaseDescription>
+ )}
+ </div>
+ <ReleaseChanges release={release} />
+ </ReleaseArticle>
+
+ <nav className="flex items-center justify-between border-t pt-8">
+ {older ? (
+ <Link
+ href={`/changelog/${older.version}`}
+ className="flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground group"
+ >
+ <ChevronLeftIcon className="size-4" />
+ <div className="flex flex-col">
+ <span className="text-xs text-muted-foreground/60">Older</span>
+ <span className="font-medium">{older.title}</span>
+ </div>
+ </Link>
+ ) : (
+ <div />
+ )}
+ {newer ? (
+ <Link
+ href={`/changelog/${newer.version}`}
+ className="flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground group text-right"
+ >
+ <div className="flex flex-col">
+ <span className="text-xs text-muted-foreground/60">Newer</span>
+ <span className="font-medium">{newer.title}</span>
+ </div>
+ <ChevronRightIcon className="size-4" />
+ </Link>
+ ) : (
+ <div />
+ )}
+ </nav>
+ </div>
+ </BasePage>
+ );
+}
|
